package com.shuigu.controller;


import com.shuigu.pojo.entity.UmsSysLog;
import com.shuigu.response.PageResult;
import com.shuigu.response.ShuiGuResult;
import com.shuigu.pojo.dto.UmsLogParamDto;
import com.shuigu.service.IUmsSysLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 操作日志记录 前端控制器
 * </p>
 *
 * @author hsg
 * @since 2024-05-30
 */
@Slf4j
@RestController
@RequestMapping("/sys/log")
public class UmsSysLogController {

    private final IUmsSysLogService umsSysLogService;

    public UmsSysLogController(IUmsSysLogService umsSysLogService){
        this.umsSysLogService = umsSysLogService;
    }

    @GetMapping
    public ShuiGuResult listAll(UmsLogParamDto logParamDto){
        log.info("全部日志============>");
        PageResult<UmsSysLog> pageResul = umsSysLogService.listAll(logParamDto);
        return ShuiGuResult.success(pageResul);
    }

    @GetMapping("/getById/{id}")
    public ShuiGuResult getById(@PathVariable Integer id){
        return ShuiGuResult.success(umsSysLogService.getById(id));
    }

    /*@DeleteMapping("/{id}")
    public DaoCaoResult deleteLog(@PathVariable("id") Integer id){
        boolean flag = umsSysLogService.removeById(id);
        if(flag){
            return DaoCaoResult.success();
        }
        return DaoCaoResult.error("删除日志失败");
    }*/

}
